﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AdvanceLib.Core
{
    public class Singleton<TClass> where TClass : class, new()
    {
        #region Static Fields
        private static TClass instance;
        #endregion

        #region Static Properties
        public static TClass Instance
        {
            get
            {
                if (Singleton<TClass>.instance == null)
                {
                    Singleton<TClass>.instance = new TClass();
                }
                return Singleton<TClass>.instance;
            }
        }
        #endregion

        #region Static Methods
        public static void Reset()
        {
            Singleton<TClass>.instance = default(TClass);
        }
        #endregion
    }
}
